import axios from 'axios'

const request = axios.create({
  baseURL: 'https://hdmstest.mollydoctor.com/api',
  timeout: 80000,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8'
  }
})

axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
axios.defaults.headers.get['Content-Type'] = 'application/json'

request.interceptors.request.use((config) => {
  let token = localStorage.getItem('token')
  console.info('>> 获取到的token:' + token)
  config.headers['token'] = token
  return config
})
export default request
